package com.zzj.config;

import com.zzj.interceptor.AuthInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AuthInterceptorConfig implements WebMvcConfigurer {

    @Resource
    private AuthInterceptor authInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(authInterceptor);


        registration.excludePathPatterns("/user/wxLogin");
        registration.excludePathPatterns("/user/login");
        registration.excludePathPatterns("/user/register");
        registration.excludePathPatterns("/user/emailLogin");
        registration.excludePathPatterns("/user/forget");


        registration.excludePathPatterns("/mail/code");

//        registration.excludePathPatterns("/upload/**");


        registration.excludePathPatterns("/v3/**");
        registration.excludePathPatterns("/swagger-ui/**");

        registration.addPathPatterns("/**");


    }
}
